package L1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 出租
 */
public class _027 {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        List<Integer> list = new ArrayList<>();
        for (int i=0;i<line.length();i++){
            Integer t = line.charAt(i)-'0';
            if (!list.contains(t)){
                list.add(t);
            }
        }
        Collections.sort(list);
        Collections.reverse(list);
        System.out.print("int[] arr = new int[]{");
        for (int i=0;i<list.size()-1;i++){
            System.out.print(list.get(i)+",");
        }
        System.out.println(list.get(list.size()-1)+"};");
        System.out.print("int[] index = new int[]{");
        for (int i=0;i<line.length()-1;i++){
            int index = list.indexOf(line.charAt(i) - '0');
            System.out.print(index+",");
        }
        System.out.println(list.indexOf(line.charAt(line.length()-1)-'0')+"};");
    }
}
